/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2024-01-04 15:43:57
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-01-17 14:18:29
 * @FilePath: /yt-devops/lib/pages/devices/device_tab/device_detail/electric_meter/electric_meter_model.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:yt_devops/model/device_obj/group_config_model.dart';
import 'package:yt_devops/model/device_obj/properties_model.dart';

class MeterGridModel {
  String? name;
  List<GroupConfigModel<PropertiesModel>> children;

  MeterGridModel({this.name, required this.children});

  factory MeterGridModel.fromJson(Map<String, dynamic> json) => MeterGridModel(
      name: json['name'],
      children: json['children'] == null
          ? []
          : json['children'].map<GroupConfigModel<PropertiesModel>>((i) {
              var model = GroupConfigModel<PropertiesModel>.fromJson(i);
              model.setChildren = i['children'] == null
                  ? []
                  : (i['children'] as List)
                      .map<PropertiesModel>((e) => PropertiesModel.fromJson(e))
                      .toList();
              return model;
            }).toList() as List<GroupConfigModel<PropertiesModel>>);
}
